<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8" />
    <link rel="apple-touch-icon" sizes="76x76" href="{_INDEX_STATIC_}/moban/assets/img/apple-icon.png">
    <link rel="icon" type="image/png" href="{_INDEX_STATIC_}/moban/assets/img/favicon.png">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <title>首页 | {$system_name}</title>
    <meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no'
        name='viewport' />
    <link href="{_INDEX_STATIC_}/moban/assets/css/bootstrap.min.css" rel="stylesheet" />
    <link href="{_INDEX_STATIC_}/moban/assets/css/now-ui-kit.css?v=1.1.0" rel="stylesheet" />
    <link href="{_INDEX_STATIC_}/moban/assets/css/font-awesome.min.css" rel="stylesheet" />

    <!-- 加载 echarts -->
    <script src="https://cdn.staticfile.org/echarts/4.3.0/echarts.min.js"></script>
</head>

<body class="index-page sidebar-collapse">

    <!-- 引入导航栏 -->
    {include file='public/header'}

    <div class="container" style="margin-bottom: 10px;">
        <!-- 个人信息 -->
        <div class="row">
            <div class="col-md-12">
                <h3>个人基本信息</h3>
            </div>
            <div class="col-md-12">
                <div class="table-responsive">
                    <table class="table">
                        <tr>
                            <td>姓名</td>
                            <td>{$user_info_data.name}</td>
                            <td>年龄</td>
                            <td>{$user_info_data.age}</td>

                        </tr>
                        <tr>
                            <td>职务</td>
                            <td>{$user_info_data.position}</td>
                            <td>手机</td>
                            <td>{$user_info_data.phone}</td>
                        </tr>
                        <tr>
                            <td>邮箱</td>
                            <td>{$user_info_data.email}</td>
                            <td>QQ</td>
                            <td>{$user_info_data.qq}</td>
                        </tr>
                        <tr>
                            <td>办公室电话</td>
                            <td>{$user_info_data.tel}</td>
                            <td>微信</td>
                            <td>{$user_info_data.wx}</td>
                        </tr>
                        <tr>
                            <td>办公室地址</td>
                            <td colspan="3">{$user_info_data.address}</td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>

        <!-- 功能列表 -->
        <div class="row">
            <div class="col-md-12">
                <h3>功能列表</h3>
            </div>
            <div class="col-md-12">
                <ul class="nav nav-pills nav-pills-primary" role="tablist">

                    {if condition="$all_super_authority or $common_role_edit"}
                    <li class="nav-item" onclick="user_edit('{$user_info_data.id}')" style="cursor: pointer;">
                        <span class="nav-link active" data-toggle="tab" role="tablist" aria-expanded="false">
                            <i class="fa fa-user-circle-o"></i>
                        </span>
                        <p>修改信息</p>
                    </li>
                    {/if}

                    {if condition="$all_super_authority or $common_role_password"}
                    <li class="nav-item" onclick="user_password('{$user_info_data.id}')" style="cursor: pointer;">
                        <span class="nav-link active" data-toggle="tab" role="tablist" aria-expanded="false">
                            <i class="fa fa-lock"></i>
                        </span>
                        <p>修改密码</p>
                    </li>
                    {/if}

                    {if condition="$all_super_authority or $results_management"}
                    <li class="nav-item" onclick="achievement('{$user_info_data.id}')" style="cursor: pointer;">
                        <span class="nav-link active" data-toggle="tab" role="tablist" aria-expanded="true">
                            <i class="fa fa-edit"></i>
                        </span>
                        <p>成果管理</p>
                    </li>
                    {/if}

                    {if condition="$all_super_authority or $results_the_audit"}
                    <li class="nav-item" onclick="achievement_audit('{$user_info_data.id}')" style="cursor: pointer;">
                        <span class="nav-link active" data-toggle="tab" role="tablist" aria-expanded="true">
                            <i class="fa fa-battery-3"></i>
                        </span>
                        <p>成果审核</p>
                    </li>
                    {/if}

                    <!--                     
                        <li class="nav-item" >
                        <span class="nav-link disabled" data-toggle="tab" role="tablist">
                            <i class="fa fa-exclamation"></i>
                        </span>
                        <p>成果录入</p>
                    </li> -->
                </ul>
            </div>
        </div>


        <!-- 审核进度 -->
        <!-- <div class="row" style="margin-top: 60px;">
            <div class="col-md-12">
                <h3>审核进度</h3>
            </div>
            <div class="col-md-12">

            </div>
        </div> -->

        <!-- 成果统计图表 -->

        <div class="row" style="border-radius: 20px ;height: 455px;border: 1px solid #ddd;">
            <div class="col-md-12">
                <h3>成果统计图表</h3>
                <div id="charts_data" style="display:none">{$achievement_analysis_res}</div>
                <div id="charts_data_2" style="display:none">{$achievement_analysis_through_count_res}</div>
            </div>
            <!-- 柱状图 -->
            <div class="col-md-6">
                <div id="charts_bar" style="width: 100%;height:400px;"></div>
            </div>
            <!-- 分布图 -->
            <div class="col-md-6">
                <div id="negative" style="width: 100%;height:400px;"></div>
            </div>
        </div>


    </div>

    <!-- 引入页脚 -->
    {include file='public/footer'}

    <!-- 加载 echarts JS -->
    <script src="{_INDEX_STATIC_}/index-echarts/myChart.js"></script>

    <script>
        var data = HTMLDecode($('#charts_data').html());
        data = JSON.parse(data);

        var data2 = HTMLDecode($('#charts_data_2').html());
        data2 = JSON.parse(data2);

        if (data != '') {
            // 柱状图
            var charts_bar = echarts.init(document.getElementById('charts_bar'));
            var option = myCharts.charts_bar('各个成果总量', '成果总量', data);
            charts_bar.setOption(option);
        }

        if (data2 != '') {
            // 分布图
            var negative = echarts.init(document.getElementById('negative'));
            var option = myCharts.negative(data2);
            negative.setOption(option);
        }

        // 转义字符
        function HTMLDecode(text) {
            var temp = document.createElement("div");
            temp.innerHTML = text;
            var output = temp.innerText || temp.textContent;
            temp = null;
            return output;
        }
    </script>

    <script>
        // 用户信息编辑
        function user_edit(uid) {
            redirect_url("{:url('User/user_edit')}?uid=" + uid);
        }

        // 修改密码
        function user_password(uid) {
            redirect_url("{:url('User/user_password')}?uid=" + uid);
        }

        // 成果管理
        function achievement(uid) {
            redirect_url("{:url('Achievement/index')}");
        }

        // 成果审核
        function achievement_audit() {
            redirect_url("{:url('achievement_audit/index')}");
        }

        // 重定向
        function redirect_url(url) {
            window.location.href = url;
        }
    </script>

</body>

</html>